Skip to content

panic-on-uninit: adjust checks to 0x01-filling#101061

Merged
bors merged 1 commit intorust-lang:masterfrom
RalfJung:panic-on-uninit
Oct 5, 2022
Merged

panic-on-uninit: adjust checks to 0x01-filling#101061
bors merged 1 commit intorust-lang:masterfrom
RalfJung:panic-on-uninit

Conversation

@RalfJung
Copy link
Member

@RalfJung RalfJung commented Aug 26, 2022

Now that mem::uninitiailized actually fills memory with 0x01 (#99182), we can make it panic in a few less cases without risking a lot more UB -- which hopefully slightly improves compatibility with some old code, and which might increase the chance that we can check inside arrays in the future.

We detect almost all of these with our lint, so authors of such code should still be warned -- but if this happens deep inside a dependency, the panic can be quite interruptive, so it might be better not to do it when there is no risk of LLVM UB. Therefore, adjust the might_permit_raw_init logic to care primarily about LLVM UB. To my knowledge, it actually covers all cases of LLVM UB now.

Fixes #66151

Cc @5225225

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tracking issue for panics in mem::uninitialized/zeroed